package com.itheima.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.health.dao.ClearOrderSettingDao;
import com.itheima.health.service.ClearOrderSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class ClearOrderSettingServiceImpl implements ClearOrderSettingService {
    /*
     * 定时清理数据库数据
     * */
//    dao层依赖注入
    @Autowired
    private ClearOrderSettingDao clearOrderSettingDao;
    @Override
    public void deleteAll() {
        //调用dao的查询方法
        int count=clearOrderSettingDao.selectAll();
        if (count == 0) {
            System.out.println("数据库为空！");
            ;
        } else {
//            调用清空方法
            clearOrderSettingDao.deleteAll();
        }
    }
}
